export class Camera {
    viewX = 0;
    viewY = 0;
    zoom = 1;
    constructor() {
        this.viewX = 0;
        this.viewY = 0;
        this.zoom = 1;
    }

    // 每帧更新视口位置
    update() {

        // 计算相机中心点（视口跟随目标）
        // const centerX = this.target.localX;
        // const centerY = this.target.localY;

        // const computedX = this.viewX + (centerX - this.viewX);
        // const computedY = this.viewY + (centerY - this.viewY);
        // 平滑过渡（可选）
        // this.viewX = Math.min(window.innerWidth - 400, computedX < 0 ? 0 : computedX > window.innerWidth ? window.innerWidth : computedX);
        // this.viewY = Math.min(window.innerHeight - , computedY < 0 ? 0 : computedY > window.innerHeight ? window.innerHeight : computedY);

        // const lastPressKey = pressKeys[pressKeys.length - 1]
        // if (lastPressKey) {
        //     this.viewX += this.target._vx;
        //     this.viewY += this.target._vy;
        //     // this.app.ground.x = -this.viewX * this.zoom;
        //     // this.app.ground.y = -this.viewY * this.zoom;
        //     this.app.ground.move({
        //         x: -this.target._vx,
        //         y: -this.target._vy,
        //     })
        // }
    }
}
